﻿#ifndef CSCUTCHEONHANDLER_H
#define CSCUTCHEONHANDLER_H

#include "ga/guieventhandler.h"
#include "globecontrol/globecontrol.h"

class CScreenScutcheon;
class CScutcheonEventObject;
class  CScutcheonHandler : public EarthView::World::Spatial3D::Controls::CGUIEventHandler
{

public:

	CScutcheonHandler();

	~CScutcheonHandler();

	static CScutcheonHandler* getSingletonPtr();

	ev_bool handleEvent(EarthView::World::Spatial::SystemUI::CGUIEvent* guiEvent);

	ev_bool handleMouseMoveEvent(EarthView::World::Spatial::SystemUI::CGUIEvent* guiEvent);

	void addScutcheon(CScreenScutcheon* ref_scutcheon);

	void setGlobeControl(EarthView::World::Spatial3D::Controls::CGlobeControl* ref_globeControl);

	void setEventObject(CScutcheonEventObject* ref_eventObject);

protected:

	bool isInBoundingBox(CScreenScutcheon* ref_scutcheon,
		const int& x, const int& y);

	void computeSelected(ev_int32 x, ev_int32 y);

protected:

	CScutcheonEventObject* mpEventObject;

	EVString mScutcheonName;

	EarthView::World::Spatial3D::Controls::CGlobeControl* ref_mpGlobeControl;

	static CScutcheonHandler* mpSingleton;

	std::vector<CScreenScutcheon* > mScutcheonVector;

};

#endif
